package com.imti.mall.sale.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;

import com.imti.mall.model.sms.pojo.SmsHomeNewProduct;

import com.imti.mall.model.sms.vo.SmsHomeNewProductPicVo;
import com.imti.mall.sale.mapper.SmsHomeNewProductMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.UpdateProvider;

import java.util.List;
@Mapper
public interface SmsHomeNewProductDao extends BaseMapper<SmsHomeNewProduct> {

    /**
     * 查询新品推荐商品
     */
    @SelectProvider(type= SmsHomeNewProductMapper.class,method = "findSmsHomeNewProduct")
    public List<SmsHomeNewProduct> findSmsHomeNewProduct (SmsHomeNewProduct smsHomeNewProduct);

    /**
     * 修改新品推荐商品
     * @param smsHomeNewProduct
     * @return
     */
    @UpdateProvider(type= SmsHomeNewProductMapper.class,method = "updateSmsHomeNewProduct")
    public Integer updateSmsHomeNewProduct(SmsHomeNewProduct smsHomeNewProduct);

    /**
     * 查询图片信息
     * @param smsHomeNewProductPicVo
     * @return
     */
    @Select("SELECT shnp.*,pp.pic,pp.price FROM sms_home_new_product shnp INNER JOIN pms_product pp ON  shnp.product_id=pp.id")
    public  List<SmsHomeNewProductPicVo> findSmsHomeNewProductPic(SmsHomeNewProductPicVo smsHomeNewProductPicVo);
}
